<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="contextPath" value="${pageContext.request.contextPath}"/>

	<form role="form" id="myform">
		<div class="form-title">
           	项目信息
        </div>
        <div class="row">
        	<input type="hidden" name="id" id="id" value="${project.id }"/>
        	<!--<div class="col-sm-4">
               <div class="form-group">
                   <label for="idNumber">年份</label>
                   <input type="text" class="form-control" style="width:170px" id="year" name="year" autocomplete="off" <c:if test="${htmlPageType == 'edit'}">
                   		value="${project.year}" </c:if> placeholder="年份">
               </div>
            </div>   
        	<div class="col-sm-4">
               <div class="form-group">
                   <label for="idNumber">合同编号</label>
                   <input type="text" class="form-control" style="width:170px" id="contractnum" name="contractnum" autocomplete="off" <c:if test="${htmlPageType == 'edit'}">
                   		value="${project.contractnum}" </c:if> placeholder="合同编号">
               </div>
            </div>    --> 
        	<div class="col-sm-3">
               <div class="form-group">
                   <label for="idNumber">项目名称</label>
                   <input type="text" class="form-control" style="width:320px" id="projectname" name="projectname" autocomplete="off" <c:if test="${htmlPageType == 'edit'}">
                   		value="${project.projectname}" </c:if> placeholder="项目名称">
               </div>
            </div>   
        	<div class="col-sm-3">
               <div class="form-group">
                   <label for="idNumber">项目负责人</label>
                   <input type="text" class="form-control" style="width:320px" id="projectchargehand" name="projectchargehand" autocomplete="off" 
                   <c:choose>
                   	<c:when test="${htmlPageType == 'edit'}">
                   		value="${project.projectchargehand}"
                   	</c:when>
                   	<c:otherwise>
                   		value="李楠"
                   	</c:otherwise>
                   </c:choose> placeholder="项目负责人">
               </div>
            </div>   
        	<div class="col-sm-3">
               <div class="form-group">
                   <label for="idNumber">签约公司</label>
                   <input type="text" class="form-control" style="width:320px" id="signingcompany" name="signingcompany" autocomplete="off" <c:if test="${htmlPageType == 'edit'}">
                   		value="${project.signingcompany}" </c:if> placeholder="签约公司">
               </div>
            </div>   
        	<div class="col-sm-3">
               <div class="form-group">
                   <label for="idNumber">客户名称</label>
                   <input type="text" class="form-control" style="width:320px" id="customername" name="customername" autocomplete="off" <c:if test="${htmlPageType == 'edit'}">
                   		value="${project.customername}" </c:if> placeholder="客户名称">
               </div>
            </div>   
        	
            
            <div class="col-sm-3">
               <div class="form-group">
                   <label for="province">省份</label>
                   <select id="province" name="province" style="width:320px;" class="form-control">
                   	 <c:forEach items="${provinceList }" var="item">
                   	 	<option value="${item.areaCode }" <c:if test="${item.areaCode == project.province }">selected</c:if> >${item.areaName }</option>
                   	 </c:forEach>
                   </select>
               </div>
            </div>
            <div class="col-sm-3"> 
               <div class="form-group">
                   <label for="city">城市</label>
                   <select id="city" name="city" style="width:320px;" class="form-control">
                   	 <c:forEach items="${cityList }" var="item">
                   	 	<option value="${item.areaCode }" <c:if test="${item.areaCode == project.city }">selected</c:if> >${item.areaName }</option>
                   	 </c:forEach>
                   </select>
               </div>
            </div>
            <div class="col-sm-3">
               <div class="form-group">
                   <label for="district">区、县</label>
                   <select id="district" name="district" style="width:320px;" class="form-control">
                   	 <c:forEach items="${districtList }" var="item">
                   	 	<option value="${item.areaCode }" <c:if test="${item.areaCode == project.district }">selected</c:if> >${item.areaName }</option>
                   	 </c:forEach>
                   </select>
               </div>
            </div>
            
        	<div class="col-sm-3">
               <div class="form-group">
                   <label for="idNumber" style="display:block;">客户分类</label>
                   	<select id="customertype" name="customertype" style="width:320px;" class="form-control" tabindex="-1" >
                   	<c:if test="${project.customertype eq '' || project.customertype eq undefined}">
                        <option value="gov">政府</option>
                        <option value="cl">残联</option>
                        <option value="sch">学校</option>
                        <option value="other">其他</option>
                    </c:if>
                   	<c:if test="${project.customertype eq 'gov'}">
                        <option value="gov" selected="selected">政府</option>
                        <option value="cl">残联</option>
                        <option value="sch">学校</option>
                        <option value="other">其他</option>
                    </c:if>
                   	<c:if test="${project.customertype eq 'cl'}">
                        <option value="gov">政府</option>
                        <option value="cl" selected="selected">残联</option>
                        <option value="sch">学校</option>
                        <option value="other">其他</option>
                    </c:if>
                   	<c:if test="${project.customertype eq 'sch'}">
                        <option value="gov">政府</option>
                        <option value="cl">残联</option>
                        <option value="sch" selected="selected">学校</option>
                        <option value="other">其他</option>
                    </c:if>
                   	<c:if test="${project.customertype eq 'other'}">
                        <option value="gov">政府</option>
                        <option value="cl">残联</option>
                        <option value="sch">学校</option>
                        <option value="other" selected="selected">其他</option>
                    </c:if>
               		</select>
               		
               </div>
            </div>   
        	<div class="col-sm-3">
               <div class="form-group">
                   <label for="idNumber">签约开始日期</label>
                   <input type="text"  class="form-control" style="width:320px" 
                          id="signingstart" name="signingstart" autocomplete="off" 
                          <c:if test="${htmlPageType == 'edit'}">
                   		  value="<fmt:formatDate value='${project.signingstart}' 
                   		  type='date' pattern='yyyy-MM-dd'/>"</c:if> 
                   	placeholder="签约开始日期">
               </div>
            </div>   
        	<div class="col-sm-3">
               <div class="form-group">
                   <label for="idNumber">项目结束日期</label>
                   <input type="text" class="form-control" style="width:320px" id="signingend" name="signingend" autocomplete="off" <c:if test="${htmlPageType == 'edit'}">
                   		value="<fmt:formatDate value='${project.signingend}' type='date' pattern='yyyy-MM-dd'/>"</c:if> placeholder="项目结束日期">
               </div>
            </div> 
        	<div class="col-sm-3">
               <div class="form-group">
                   <label for="idNumber">项目实施日期</label>
                   <input type="text" class="form-control" style="width:320px" id="implementationdate" name="implementationdate" autocomplete="off" <c:if test="${htmlPageType == 'edit'}">
                   		value="<fmt:formatDate value='${project.implementationdate}' type='date' pattern='yyyy-MM-dd'/>"</c:if> placeholder="项目实施日期">
                   <input type="hidden" class="form-control" style="width:320px" id="reminder" name="reminder" autocomplete="off" <c:if test="${htmlPageType == 'edit'}">
                   		value="<fmt:formatDate value='${project.implementationdate}' type='date' pattern='yyyy-MM-dd'/>"</c:if> placeholder="提醒日期">
               </div>
            </div> 
            <div class="col-sm-3">
               <div class="form-group">
                   <label for="idNumber" style="display:block;">维护费</label>
                   	<select id="freemaintenance" name="freemaintenance" style="width:320px;" tabindex="-1" >
                   	<c:if test="${project.freemaintenance eq '0' || project.freemaintenance eq undefined}">
                        <option value="0" selected="selected">无</option>
                        <option value="1">免1年</option>
                        <option value="2">免2年</option>
                        <option value="3">免3年</option>
                        <option value="e">每年收取</option>
                    </c:if>
                   	<c:if test="${project.freemaintenance eq '1'}">
                       	<option value="0">无</option>
                        <option value="1" selected="selected">免1年</option>
                        <option value="2">免2年</option>
                        <option value="3">免3年</option>
                        <option value="e">每年收取</option>
                    </c:if>
                   	<c:if test="${project.freemaintenance eq '2'}">
                        <option value="0">无</option>
                        <option value="1">免1年</option>
                        <option value="2" selected="selected">免2年</option>
                        <option value="3">免3年</option>
                        <option value="e">每年收取</option>
                    </c:if>
                   	<c:if test="${project.freemaintenance eq '3'}">
                        <option value="0">无</option>
                        <option value="1">免1年</option>
                        <option value="2">免2年</option>
                        <option value="3" selected="selected">免3年</option>
                        <option value="e">每年收取</option>
                    </c:if>
                   	<c:if test="${project.freemaintenance eq 'e'}">
                        <option value="0">无</option>
                        <option value="1">免1年</option>
                        <option value="2">免2年</option>
                        <option value="3">免3年</option>
                        <option value="e" selected="selected">每年收取</option>
                    </c:if>
                   	
               		</select>
               		
               </div>
            </div>  
            
        	<!-- <div class="col-sm-4">
               <div class="form-group">
                   <label for="idNumber">数据创建时间</label>
                   <p class="form-control" style="width:170px" id="createtime" ><fmt:formatDate value='${project.createtime}' type='date' pattern='yyyy-MM-dd'/></p>
               </div>
            </div>  
            
        	<div class="col-sm-4">
               <div class="form-group">
                   <label for="idNumber">数据更新时间</label>
                   <p class="form-control" style="width:170px" id="updatetime" ><fmt:formatDate value='${project.updatetime}' type='date' pattern='yyyy-MM-dd'/></p>
               </div>
            </div>   -->
            
        	<div class="col-sm-3">
               <div class="form-group">
                   <label for="idNumber">编辑人</label>
                   <input type="text" class="form-control" style="width:320px" id="editperson" name="editperson" autocomplete="off" <c:if test="${htmlPageType == 'edit'}">
                   		value="${project.editperson}" </c:if> placeholder="编辑人">
               </div>
            </div>  
            
        <!-- <div class="col-sm-6">
               <div class="form-group">
                   <label for="idNumber" style="display:block;">上传图片</label>
                   <input type="hidden" id="fileName" name="fileName" value="${project.fileid}"/>
					<div class="col-sm-2">
						<button class="btn btn-primary" id="btnFileUpload">上传</button>
					</div>
               </div>
            </div>   -->	
            
            <div class="col-sm-11">
	            <div class="form-group">
	               <label for="exampleInputEmail2">备注</label>
	               <span class="input-icon icon-right">
	                   <textarea class="form-control" rows="2" id="remarks" name="remarks">${project.remarks}</textarea>
	               </span>
	           	</div>
	        </div>
        </div>
        
		<div class="form-group text-center">
			<c:if test="${htmlPageType == 'new'}">
		        <button type="button" class="btn btn-primary" onclick="server.submitForm('myform','/project/add',common.validate,null,common.paginationQuery,1)">保存</button>
			</c:if>
			<c:if test="${htmlPageType == 'edit'}">
		        <button type="button" class="btn btn-primary" onclick="server.submitForm('myform','/project/edit',common.validate,null,common.paginationQuery,1)">保存</button>
			</c:if>
	        <button type="button" class="btn btn-danger" onclick="server.closeModalBox()">关闭</button>
	     </div>
	</form>
	<script src="${contextPath }/assets/ajaxupload/js/ajaxupload.3.6.js"></script>
	<script src="${contextPath }/assets/common/js/fileoperator.js"></script>
	<script type="text/javascript">
	$(document).ready(function() {
		server.loadSecondDatePick("#signingstart");
		server.loadSecondDatePick("#signingend"); 
		server.loadSecondDatePick("#implementationdate"); 
		
		$("#signingstart").on("change",function(){
			var signingstartVal = $("#signingstart").val();
			var arr = signingstartVal.split("-");
			var b = arr[0];
			c = parseInt(b)+1;
			var str = "";
			for(var i=1;i<arr.length;i++){
				str = str+"-"+arr[i];
			}
			c = c+str;
			$("#signingend").val(c);
		});
		
		//省市区联动事件
		server.selectChange("","#province","#city","#district");
	});
</script>